<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <title>上传批次[{{ $upload_batch->id }}]</title>
    <style>
     table {
         font-family: verdana,arial,sans-serif;
         font-size:11px;
         color:#333333;
         border-width: 1px;
         border-color: #666666;
         border-collapse: collapse;
         width: 100%;
     }
     table th {
         border-width: 1px;
         padding: 8px;
         border-style: solid;
         border-color: #666666;
         background-color: #dedede;
         text-align: center;
     }
     table td {
         border-width: 1px;
         padding: 8px;
         border-style: solid;
         border-color: #666666;
         background-color: #ffffff;
         text-align: center;
     }
    </style>
</head>
<body>
<table>
<tbody>

    <tr>
        <td>批次号</td>
        <td>
            <input disabled type='text' name='number' value='{{ $upload_batch->number }}' style="width: 80%;">
        </td>
    </tr>
    <tr>
        <td>创建时间</td>
        <td>
            <input disabled type='text' name='create_time' value='{{ $upload_batch->create_time }}'>
        </td>
    </tr>
    <tr>
        <td>匹配时间</td>
        <td>
            <input disabled type='text' name='update_time' value='{{ $upload_batch->format_time }}'>
        </td>
    </tr>

</tbody>
</table>

<p>
<form action="" method="POST"> 原始地址 <input type="submit" value="重新匹配"> </form>
</p>

<table>
<thead>
    <tr>
        <th>序号</th>
        <th>收货人姓名</th>
        <th>收货人手机号</th>
        <th>小区名</th>
        <th>细节地址</th>
        <th>地址状态</th>
        <th>最终识别后的地址</th>
        <th>
            <a href='/raw_addresses/add'>添加</a>
        </th>
    </tr>
</thead>
    @php
        $can_export = true;
        $count_of_can_not_export = 0;
    @endphp
    @foreach ($raw_addresses as $id => $raw_address)
    @php
        if ($raw_address->status_is_init()
         || $raw_address->status_is_not_found()
         || $raw_address->status_is_not_complete()) {
            $can_export = false;
            $count_of_can_not_export += 1;
        }
    @endphp
    <tr>
        <td>
            {{ $raw_address->number }}
        </td>
        <td>
            {{ $raw_address->person_name }}
        </td>
        <td>
            {{ $raw_address->person_mobile_number }}
        </td>
        <td>
            {{ $raw_address->estate_name }}
        </td>
        <td>
            {{ $raw_address->house_address }}
        </td>
        <td status="{{ $raw_address->status }}">
            {{ $raw_address->get_status_description() }}
        </td>
        <td>
            {{ $raw_address->snap_formated_address_string }}
        </td>
        <td>
            <a href='/raw_addresses/update/{{ $raw_address->id }}'>修改</a>
            <a href='javascript:delete_{{ $raw_address->id }}.submit();'>删除</a>
            <form id='delete_{{ $raw_address->id }}' action='/raw_addresses/delete/{{ $raw_address->id }}' method='POST'></form>
        </td>
    </tr>
    @endforeach
<tbody>
</tbody>
</table>

<p>
<form action="/upload_batches/export/{{ $upload_batch->id }}" method="POST"> {{ $can_export?'完成格式化':"有 <span style='color:red;'>$count_of_can_not_export </span> 个地址未完成格式化" }}<input {{ $can_export?'':'disabled' }} type="submit" value="导出文件"> </form>
</p>

</body>
<script type="text/javascript" src="/static/js/jquery-1.5.min.js"></script>
<script>
$(function () {

    $('[status=NOT_FOUND]').css('color', 'red');
    $('[status=NOT_COMPLETE]').css('color', 'orange');
    $('[status=FORMATED]').css('color', 'green');
    $('[status=INVALID]').css('color', 'gray');
});
</script>
</html>
